package com.yidu.ruifeng_logistics.utils;

/**
 * @author: 肖楚科
 * @date: 2021/1/11
 * @time: 14:50
 * @blog: com.yidu.domain
 * @description:
 */
public class BaseMessage implements java.io.Serializable{
    private Integer state;
    private String msg;
    private Object data;
    private Integer code;

    public static BaseMessage success(Object o){
        BaseMessage baseMessage = new BaseMessage();
        baseMessage.setData(o);
        baseMessage.setState(1);
        baseMessage.setCode(0);
        baseMessage.setMsg("操作成功");
        return baseMessage;
    }

    public static BaseMessage success(){
        BaseMessage baseMessage = new BaseMessage();
        baseMessage.setState(1);
        baseMessage.setCode(0);
        baseMessage.setMsg("操作成功");
        return baseMessage;
    }

    public static BaseMessage fail(){
        BaseMessage baseMessage = new BaseMessage();
        baseMessage.setState(0);
        baseMessage.setCode(1);
        baseMessage.setMsg("操作失败");
        return baseMessage;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
